package com.opengroupe.entities;

// Generated 31 juil. 2012 15:46:15 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Reponse generated by hbm2java
 */
@Entity
@Table(name = "reponse", catalog = "qrh")
public class Reponse implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7543675082406051063L;
	private Integer idReponse;
	private String contenuReponse;
	private Set<Question> questions = new HashSet<Question>(0);
	private Set<CandidatReponseQuestion> candidatReponseQuestions = new HashSet<CandidatReponseQuestion>(
			0);
	private Set<Question> questions_1 = new HashSet<Question>(0);

	public Reponse() {
	}

	public Reponse(String contenuReponse, Set<Question> questions,
			Set<CandidatReponseQuestion> candidatReponseQuestions,
			Set<Question> questions_1) {
		this.contenuReponse = contenuReponse;
		this.questions = questions;
		this.candidatReponseQuestions = candidatReponseQuestions;
		this.questions_1 = questions_1;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idReponse", unique = true, nullable = false)
	public Integer getIdReponse() {
		return this.idReponse;
	}

	public void setIdReponse(Integer idReponse) {
		this.idReponse = idReponse;
	}

	@Column(name = "contenuReponse", length = 65535)
	public String getContenuReponse() {
		return this.contenuReponse;
	}

	public void setContenuReponse(String contenuReponse) {
		this.contenuReponse = contenuReponse;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "reponsesEventuelles")
	public Set<Question> getQuestions() {
		return this.questions;
	}

	public void setQuestions(Set<Question> questions) {
		this.questions = questions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "reponse")
	public Set<CandidatReponseQuestion> getCandidatreponsequestions() {
		return this.candidatReponseQuestions;
	}

	public void setCandidatreponsequestions(
			Set<CandidatReponseQuestion> candidatReponseQuestions) {
		this.candidatReponseQuestions = candidatReponseQuestions;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "reponsesCorrectes")
	public Set<Question> getQuestions_1() {
		return this.questions_1;
	}

	public void setQuestions_1(Set<Question> questions_1) {
		this.questions_1 = questions_1;
	}
	
	@Override
	public boolean equals(Object obj) {
		Reponse rep = (Reponse)obj;
		return this.getContenuReponse().equals(rep.getContenuReponse());
	}

}
